package cn.com.oceansoft.nos.common.spring;

import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by chenw on 2014/10/20.
 */
@Component
public class SequenceGenerator {

    private static final String ROLE_RESOURCE_ID_SEQUENCE = "T_SYS_ROLE_RESOURCE_ID_SEQ";

    @Resource
    private OracleSequenceMaxValueIncrementer oracleSequenceMaxValueIncrementer;

    public int nextRoleResourceIdSeq() {
        oracleSequenceMaxValueIncrementer.setIncrementerName(ROLE_RESOURCE_ID_SEQUENCE);
        return oracleSequenceMaxValueIncrementer.nextIntValue();
    }
}
